
let $request = (url, data = {}, method = 'GET', options) => {
	return new Promise((resolve, reject) => {
		// if(options.loading){
		// 	uni.showLoading({
		// 		title: '数据加载中'
		// 	})
		// }
		uni.request({
			url,
			method,
			data,
			success: res => {
				resolve(res)
			},
			fail: error => {
				reject(error)
			},
			complete(){
				uni.hideLoading()
			}
		})
	})
}

let $get = (url, data) => {
	return $request(url, data, "GET")
}

let $post = (url, data) => {
	return $request(url, data, 'POST')
}

uni.$request = $request
uni.$get = $get
uni.$post = $post